<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>无标题文档</title>
		<link href="css/style.css" rel="stylesheet" type="text/css" />
		<link href="css/select.css" rel="stylesheet" type="text/css" />

		<script type="text/javascript" src="js/jquery-1.12.3.min.js"></script>
		
		<script type="text/javascript" src="js/jquery.idTabs.min.js"></script>
		<script type="text/javascript" src="js/select-ui.min.js"></script>
		<script type="text/javascript" src="editor/kindeditor.js"></script>
		<script type="text/javascript">
				$(document).ready(function(e) {
					$(".select1").uedSelect({
						width : 200
					});

				});
				$(document).ready(function(){
					$(document).on("click",".click",function(){
						$(".tip").fadeIn(200);
					});

					$(document).on("click",".tiptop a",function(){
						$(".tip").fadeOut(200);
					});

					$(document).on("click",".sure",function(){
						$(".tip").fadeOut(100);
					});

					$(document).on("click",".cancel",function(){
						$(".tip").fadeOut(100);
					});

				});
		</script>



		<script type="text/javascript">
			  $(function () {
				  //发送ajax请求进行部门查询
				  $.post("sxt/DeptServlet?method=deptFindAll2",function (result) {
					     $.each(result,function (i,e) {
                             $("#dept").append("<option value='"+e.deptno+"'>"+e.deptname+"</option>")
						 })
				  },"json")

				  //调用查询方法
				  findMore();
			  })

			   function   findMore() {
				   //发送ajax请求进行信息查询
				   $.post("sxt/EmployeeServlet?method=empFindMore",$("form").serialize(),function (result) {
					   //执行清空操作即可
					   $("#tb").empty();
					   $.each(result,function (i,e) {
						   $("#tb").append("<tr>\n" +
								   "\t\t\t\t\t\t<td>\n" +
								   "\t\t\t\t\t\t\t<input name=\"\" type=\"checkbox\" value=\"\" />\n" +
								   "\t\t\t\t\t\t</td>\n" +
								   "\t\t\t\t\t\t<td>"+e.empId+"</td>\n" +
								   "\t\t\t\t\t\t<td>"+e.realName+"</td>\n" +
								   "\t\t\t\t\t\t<td>"+e.deptname+"</td>\n" +
								   "\t\t\t\t\t\t<td>"+e.pname+"</td>\n" +
								   "\t\t\t\t\t\t<td>"+e.hireDate+"</td>\n" +
								   "\t\t\t\t\t\t<td>"+e.phone+"</td>\n" +
								   "\t\t\t\t\t\t<td>\n" +
								   "\t\t\t\t\t\t\t<a href='sxt/EmployeeServlet?method=empFindOne&empid="+e.empId+"' class='tablelink'>修改</a> \n" +
								   "\t\t\t\t\t\t\t<a href='javascript:void(0)'  onclick='remove2(\""+e.empId+"\")'> 删除</a>\n" +
								   "\t\t\t\t\t\t</td>\n" +
								   "\t\t\t\t\t</tr>")

					   })
				   },"json")
			   }
			   
			   
			   function remove2(id) {

			  	 var  flag= window.confirm("是否删除该数据?");

			  	  if(flag){
			  	  	  //发送ajax请求删除指定数据
					  $.post("sxt/EmployeeServlet?method=empRemove",{empid:id},function (result) {
						   if(result>0){
						   	  //调用查询所有方法即可
							   findMore();
						   }else{
						   	alert("删除失败");
						   }
					  },"json")

				  }
				   
			   }

			   


		</script>

	</head>

	<body>

		<div class="place">
			<span>位置：</span>
			<ul class="placeul">
				<li><a href="#">人事管理</a></li>
				<li><a href="#">员工管理</a></li>
			</ul>
		</div>

		<div class="rightinfo">
<form action="">


			<ul class="prosearch">
				<li>
					<label>查询：</label><i>用户名</i>
					<a>
						<input name="empid" type="text" class="scinput" />
					</a><i>所属部门</i>
					<a>
						<select class="select1" id="dept" name="deptno">
								<option value=''>--请选择--</option>
						</select>
					</a>
								
				</li>
				<li>
					<label>是否在职：</label>
					<input name="onduty" type="radio" value="1"  />&nbsp;是&nbsp;&nbsp;
					<input name="onduty" type="radio" value="0" />&nbsp;否
				</li>
				<li>
					<label>入职时间：</label>
					<a>
						<input name="hireDate" type="text" class="scinput" />
					</a>		
				</li>
					<a>
						<input type="button" class="sure" value="查询" onclick="findMore()"/>
					</a>
			</ul>
</form>
			<div class="formtitle1"><span>员工列表</span></div>

			<table class="tablelist">
				<thead>
					<tr>
						<th>
							<input name="" type="checkbox" value="" checked="checked" />
						</th>
						<th>用户名<i class="sort"><img src="images/px.gif" /></i></th>
						<th>真实姓名</th>
						<th>所属部门</th>
						<th>所属岗位</th>
						<th>入职时间</th>
						<th>联系方式</th>
						<th>操作</th>
					</tr>


				</thead>
				<tbody id="tb">


				</tbody>
			</table>

			<a href='javascript:void(0)' class='tablelink click'> 删除</a>


			<div class="pagin">
				<div class="message">共<i class="blue">1256</i>条记录，当前显示第&nbsp;<i class="blue">2&nbsp;</i>页</div>
				<ul class="paginList">
					<li class="paginItem"><a href="javascript:;"><span class="pagepre"></span></a></li>
					<li class="paginItem"><a href="javascript:;">1</a></li>
					<li class="paginItem current"><a href="javascript:;">2</a></li>
					<li class="paginItem"><a href="javascript:;">3</a></li>
					<li class="paginItem"><a href="javascript:;">4</a></li>
					<li class="paginItem"><a href="javascript:;">5</a></li>
					<li class="paginItem more"><a href="javascript:;">...</a></li>
					<li class="paginItem"><a href="javascript:;">10</a></li>
					<li class="paginItem"><a href="javascript:;"><span class="pagenxt"></span></a></li>
				</ul>
			</div>

			<div class="tip">
				<div class="tiptop"><span>提示信息</span>
					<a></a>
				</div>

				<div class="tipinfo">
					<span><img src="images/ticon.png" /></span>
					<div class="tipright">
						<p>是否确认对信息的修改 ？</p>
						<cite>如果是请点击确定按钮 ，否则请点取消。</cite>
					</div>
				</div>

				<div class="tipbtn">
					<input name="" type="button" class="sure" value="确定"  id="but"/>&nbsp;
					<input name="" type="button" class="cancel" value="取消" />
				</div>

			</div>

		</div>

		<script type="text/javascript">
			$('.tablelist tbody tr:odd').addClass('odd');
		</script>

	</body>



</html>